﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TicketApp.DataService
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TicketApp.DataService.TicketsModelContainer context = new TicketsModelContainer();
            //context.MergeOption = System.Data.Services.Client.MergeOption.AppendOnly;
            var role = context.Roles.FirstOrDefault();
            var user = new User() { Email = "email", Password = "pwd", Phone = "123", Role = role, Status = 1, UserName = "user" };

            var address = new Address() { Line1 = "Line1", Line2 = "Line2", PostalCode = "1111", State = "State", City = "City", Country = "Country" };
            context.AddToAddresses(address);

            user.Address = address;
            // context.(user, "Address", address);

            context.AddToAllUsers(user);
            context.SaveChanges();
                

        }
    }
}